home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / openoffice / shell-lib-extensions.sh
Text File  |  2009-10-23  |  2KB  |  66 lines

  1. check_for_running_ooo() {
  2.     if [ -e /usr/lib/openoffice/program/bootstraprc ]; then
  3.         LOCKFILE=`grep UserInstallation /usr/lib/openoffice/program/bootstraprc | cut -d= -f2 | sed -e 's,SYSUSERCONFIG,HOME,'`
  4.         PID=`pgrep soffice.bin | head -n 1`
  5.         if [ -n "$PID" ] || [ -e "$LOCKFILE" ]; then
  6.             db_input high openoffice.org/running
  7.             db_go
  8.             # try again in case OOo got closed before hitting OK
  9.             PID=`pgrep soffice.bin | head -n 1`
  10.             if [ -n "$PID" ] || [ -e "$LOCKFILE" ]; then
  11.               exit 1
  12.             fi
  13.         fi
  14.     fi
  15. }
  16.  
  17. handle_soffice_listeners() {
  18.     services="docvert-converter"
  19.     for s in $services; do
  20.         if [ -x /etc/init.d/$s ]; then
  21.             if [ -x /usr/sbin/invoke-rc.d ]; then
  22.                 invoke-rc.d $s $1
  23.             else
  24.                 /etc/init.d/$s $1
  25.             fi
  26.         fi
  27.     done
  28.     # wait for proper shutdown/kill
  29.     sleep 1
  30. }
  31.  
  32. flush_unopkg_cache() {
  33.     /usr/lib/openoffice/program/unopkg list --shared > /dev/null 2>&1
  34. }
  35.  
  36. remove_extension() {
  37.   handle_soffice_listeners stop
  38.   check_for_running_ooo
  39.   if /usr/lib/openoffice/program/unopkg list --shared $1 >/dev/null; then
  40.     INSTDIR=`mktemp -d`
  41.     export PYTHONPATH="/@OOBASISDIR@/program"
  42.     basis=`readlink /usr/lib/openoffice/basis-link`
  43.     /usr/lib/openoffice/program/unopkg remove -v --shared $1 \
  44.       "-env:UserInstallation=file://$INSTDIR" \
  45.       "-env:UNO_JAVA_JFW_INSTALL_DATA=file:///var/lib/openoffice/$basis/share/config/javasettingsunopkginstall.xml" \
  46.       "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
  47.     if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
  48.     flush_unopkg_cache
  49.   fi
  50.   handle_soffice_listeners start
  51. }
  52.  
  53. add_extension() {
  54.   handle_soffice_listeners stop
  55.   check_for_running_ooo
  56.   INSTDIR=`mktemp -d`
  57.   export PYTHONPATH="/@OOBASISDIR@/program"
  58.   basis=`readlink /usr/lib/openoffice/basis-link`
  59.   /usr/lib/openoffice/program/unopkg add -v --shared $1 \
  60.     "-env:UserInstallation=file:///$INSTDIR" \
  61.     "-env:UNO_JAVA_JFW_INSTALL_DATA=file:///var/lib/openoffice/$basis/share/config/javasettingsunopkginstall.xml" \
  62.     "-env:JFW_PLUGIN_DO_NOT_CHECK_ACCESSIBILITY=1"
  63.   if [ -n $INSTDIR ]; then rm -rf $INSTDIR; fi
  64.   handle_soffice_listeners start
  65. }
  66.